package com.yokit.c2c.service;

import com.yokit.c2c.mapper.OrderMapper;
import com.yokit.c2c.pojo.Order;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author fengzeng
 * @create 2021/6/14 17:23
 */
@Service
public class OrderService {

  @Resource
  private OrderMapper orderMapper;

  public void insertOrder(Order order) {
    orderMapper.insertSelective(order);
  }

  public List<Order> selectByUserId(Integer userId) {
    return orderMapper.selectByUserId(userId);
  }

  public Order selectByOrderId(Integer orderIdInt) {
    return orderMapper.selectByPrimaryKey(orderIdInt);
  }

  public void updateByPrimaryKeySelective(Order order) {
    orderMapper.updateByPrimaryKeySelective(order);
  }

  public List<Order> selectByUserIdAndState(String userId, String state) {
    return orderMapper.selectByUserIdAndState(userId, state);

  }
}
